<template>
  <div></div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  name: 'message-box',
  computed: mapState({
    msg: state => state.msg.isShow
  }),
  methods: {
    openMessage () {
      if (this.msg) {
        this.$message({
          showClose: this.$store.state.msg.showClose,
          message: this.$store.state.msg.message,
          type: this.$store.state.msg.type
        })
        this.$store.commit('openMessage', false)
      }
    }
  },
  watch: {
    msg: 'openMessage'
  }
}
</script>